<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            height: 100px;
            color: #fff;
            background-color: #000;
        }
    </style>
    <script>
        function changeSize() {
            document.querySelector('.box').style.width = '200px';
        }
        function changeColor() {
            document.querySelector('.box').style.color = 'red';
        }
        function getOffset() {
            console.log(document.body.clientWidth) 
        }
    </script>
</head>
<body>
    <!-- 演示重排 -->
    <div class="box">
        内容
    </div>
    <button onclick="changeSize()">触发重排</button>
    <button onclick="changeColor()">触发重绘</button>
    <button onclick="getOffset()">获取offset相关属性</button>
</body>
</html>